import fetch from 'common/src/utils/fetch';

/**
 * 模板查询列表查询
 */
export function queryMinorCultureTemplateList(params) {
    let query = '?';
    for (let key in params) {
        query += key;
        query += '=';
        query += params[key];
        query += '&';
    }
    return fetch({
        url:
            '/api/cultureservice/minorCultureTemplate/minorCultureTemplatePage' +
            query.substring(0, query.length - 1),
        method: 'GET'
    });
}

/**
 * 批量删除模板
 */
export function batchDeleteTemplate(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureTemplate',
        method: 'DELETE',
        data
    });
}

/**
 * 保存模板信息
 */
export function saveTemplateInfo(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureTemplate',
        method: 'POST',
        data
    });
}

/**
 * 根据主键查询模板信息
 */
export function queryTemplateInfo(data) {
    return fetch({
        url:
            '/api/cultureservice/minorCultureTemplate/findMinorCultureTemplteById?id=' +
            data,
        method: 'GET'
    });
}

/**
 * 批量发布模板
 */
export function batchPublishTemplate(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureTemplate/release',
        method: 'put',
        data: data
    });
}

/**
 * 保存课程类型
 */
export function saveCourseTypeInfo(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureRule/batchUpdMinorCultureRule',
        method: 'POST',
        data
    });
}

/**
 * 模板撤销
 */
export function revokeTemplate(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureTemplate/revoke',
        method: 'PUT',
        data
    });
}


// 模板复制功能
export function copyMinorCultureTemplate(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureTemplate/copyMinorCultureTemplate',
        method: 'POST',
        data
    });
}

// 课程分类 新增查询
export function findNatureListByTemplteId(params) {
    return fetch({
        url: '/api/cultureservice/minorCultureTemplate/findNatureListByTemplteId',
        method: 'get',
        params
    });
}

/**
 * 
 * @param {Object} data
 * @returns 
 */
// 课程分类 新增
export function findCheckedMinorCultureLabelList(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureRule/findCheckedMinorCultureLabelList',
        method: 'post',
        data
    });
}

// 课程分类 新增
export function deleteMinorCoursesLabeById(params) {
    return fetch({
        url: '/api/cultureservice/minorCultureRule/deleteMinorCoursesLabeById',
        method: 'get',
        params
    });
}

//培养模板新增课程类别树 
export function batchUpdMinorCultureRuleForTree(data) {
    return fetch({
        url: '/api/cultureservice/minorCultureRule/batchUpdMinorCultureRuleForTree',
        method: 'POST',
        data
    });
}